R手册(Visualise) |
您所在的位置:网站首页 › ggplot2 r语言 › R手册(Visualise) |
文章目录
OverviewGeoms基本图形单变量双变量三变量文本误差可视化地图
StatsScales常用标尺格式坐标轴标尺Color and fill scalesShape and size scales
Coordinate SystemsPosition AdjustmentsThemesFacetingAnnotations and LabelsLegendsVector helpers混合图[ggplot2 extensions](https://blog.csdn.net/qq_41518277/article/details/80516938)
Overview
ggplot2 基于the grammar of graphics思想,通过数据集、几何对象和坐标系统建立图形。 所有的ggplot2绘图都以ggplot()开始, 默认由aes()将数据集映射至几何对象。在行尾+添加图层:几何,比例尺,坐标和面等。要将绘图保存,请使用ggsave() 完整的ggplot2图形包括: ggplot(data,aes(...)): Create a new ggplot (required)geom_(aes(...),data,stat,position): Geometric object (required) or stat_(aes(...),data,geom,position): Statistical transformation (required)coord_(...): Coordinate systemsfacet_(...): Facettingscale_(...): Scalestheme_(...): Themesdata, aes参数可以在ggplot, geom_, stat_任一函数中加载 aes() 控制数据中的变量映射到几何图形。aes()映射可以在ggplot()和geom图层中设置。常用参数:alpha, color, group, linetype, size ggsave(filename, plot = last_plot(),path=NULL,width, height, units= c("in", "cm", "mm"))保存ggplot2图形,默认保存最后一个图 qplot(),quickplot(): Quick plot Geoms用geom函数表现图形,geom中的aes参数映射数据,每一个geom函数添加一个图层。 geom常用几何参数常量赋值color/fillcolor/fill=NA 消除线条或填充alpha0 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |